﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BtoBSWT315
{
    public partial class TJ_SW : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GetSWServerDataBind();
        }

        private void GetSWServerDataBind()
        {
            //引入数据库操作类
            Admin.Admin_ClassDb classdb = new Admin.Admin_ClassDb();
            //定义所需sql语句
            string sql1 = "select top 10 NewsID,Title,Typename,dateandtime,typeid from Commerce where TjComme=1 order by hits desc";
            //取得结果值
            DataList1.DataSource = classdb.GetTables(sql1).DefaultView;
            DataList1.DataBind();

        }

        protected string GetTitle(string Title)
        {
            if (Title.Length > 20)
            {
                Title = Title.Substring(0, 20);
            }
            return Title;
        }
    }
}